<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title>查找公共前缀</title>
	</head>
	<body>
	     <script>
	     	var arr = ['floor','floorwe','floorazq'];
	     	function chatAt(arrays){
	     		if(arrays.length==0){return ''};
	     		var oFirst = arrays[0];
	     		for(array of arrays){
	     			var toast = '';
	     			for(var i=0,j=0;i<oFirst.length&j<array.length;i++,j++){
	     				if(oFirst[i]==array[j]){
	     					toast+=array[j];
	     				}
	     			}
	     			oFirst = toast;
	     		}
	     		return oFirst;
	     	}
	     	console.log(chatAt(arr));
	     </script>
	</body>
</html>
